using System;
using System.Runtime.CompilerServices;
using UnityEngine;

[Serializable]
public class ItemInfo
{
	public int id
	{
		get;
		set;
	}

	public string name
	{
		get;
		set;
	}

	public string desc
	{
		get;
		set;
	}

	public int type
	{
		get;
		set;
	}

	public string icon
	{
		get;
		set;
	}

	private int _value;
	public int value
	{
		[CompilerGenerated]
		get
		{
			return _value;
		}
		[CompilerGenerated]
		set
		{
			_value = value;
		}
	}

	public bool isChip => type == 4;

	public ItemInfo()
	{

	}

	[Serializable]
	class ItemInfo2
	{
		public int id;

		public string name;

		public string desc;

		public int type;

		public string icon;

		public int _value;
	}

	public string ToJson()
	{
		ItemInfo2 itemInfo2 = new ItemInfo2();
		itemInfo2.id = id;
		itemInfo2.name = name;
		itemInfo2.desc = desc;
		itemInfo2.type = type;
		itemInfo2.icon = icon;
		itemInfo2._value = value;
		return JsonUtility.ToJson(itemInfo2);
	}

	public void JsonToObject(string json)
	{
		ItemInfo2 itemInfo2 = JsonUtility.FromJson<ItemInfo2>(json);
		if (itemInfo2 == null) return;
		id = itemInfo2.id;
		name = itemInfo2.name;
		desc = itemInfo2.desc;
		type = itemInfo2.type;
		icon = itemInfo2.icon;
		value = itemInfo2._value;
	}
}
